package com.yida.system.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.yida.system.api.domain.SysUserCommunity;

/**
 * @version UPDATE
 * @Author: PPV
 * @Date: 2023-03-08
 * @Author: HMH
 * @Date: 2023-03-24
 *        <p>
 *        delByUserId > delUserAndCommunityByUserId
 *        <p>
 *        insertBatch > insertBatchUserAndCommunity
 */
@Mapper
public interface SysUserCommunityMapper {

    /**
     * 根据用户ID删除绑定小区
     *
     * @param userId 用户ID
     * @return
     */
    boolean delUserAndCommunityByUserId(Long userId);

    /**
     * 批量绑定
     *
     * @param userId 用户id
     * @param streetId 街道id
     * @param communityIds 小区id
     * @return
     */
    boolean insertBatchUserAndCommunity(@Param("userId") Long userId, @Param("streetId") Long streetId, @Param("communityIds") List<Long> communityIds);

    /**
     * 根据用户ID获取绑定小区数据
     *
     * @param userId
     * @return
     */
    List<SysUserCommunity> getBindCommunities(Long userId);

    /**
     * 根据用户ID批量删除用户项目关联
     * 
     * @param userIds
     * @return
     */
    public int deleteUserCommunityByUserIds(Long[] userIds);

}
